// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   OrderCancelProcessor.java

package com.boci.clientapp.orderstatus.processor;

import com.boci.clientapp.orderstatus.vo.FilledOrderVO;
import com.boci.clientapp.orderstatus.vo.OrderCancelVO;
import com.boci.common.processor.AbstractResponseProcessor;
import com.boci.common.vo.ResponseVO;
import java.util.ArrayList;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

public class OrderCancelProcessor extends AbstractResponseProcessor
{

    public OrderCancelProcessor(String pXML, String pReqType)
        throws Exception
    {
        super(pXML, pReqType, "ORDER_STATUS.ERROR_");
    }

    public ResponseVO processXML()
        throws Exception
    {
        strReqType = getReqType();
        strRtnCode = getReturnCode();
        String strOrderId = getNodeValue("ORDER_ID");
        OrderCancelVO orderCancelVO = new OrderCancelVO(getReqType(), getReturnCode());
        orderCancelVO.setOrderId(strOrderId);
        return orderCancelVO;
    }

    public ArrayList transformVOList(NodeList pNodeList)
    {
        int nodeLength = pNodeList.getLength();
        ArrayList list = new ArrayList();
        for(int i = 0; i < nodeLength; i++)
        {
            FilledOrderVO filledOrderVO = new FilledOrderVO(strReqType, strRtnCode);
            Element element = (Element)pNodeList.item(i);
            String strFilledQuantity = getNodeValue(element, "FILLED_QUANTITY");
            String strFilledPrice = getNodeValue(element, "FILLED_PRICE");
            filledOrderVO.setFilledQuantity(strFilledQuantity);
            filledOrderVO.setFilledPrice(strFilledPrice);
            list.add(filledOrderVO);
        }

        return list;
    }

    String strRtnCode;
    String strReqType;
}
